class Permission < ActiveRecord::Base

  validates :ability, :class_name, :presence => true

  def ability_at
    i18n_at("abilities.#{class_name}.#{ability}")
  end

  def class_name_at
    i18n_at("class_name.#{class_name}")
  end

  private

  def i18n_at(attribute)
    I18n.t("activemodel.attributes.permission.#{attribute}")
  end
end
